﻿using System;
using Business;
using System.Data;
using System.Collections.Generic;
using Entity;

namespace UI_MasterPage
{
    public partial class PresentationMain : System.Web.UI.MasterPage
    {
        public ArticleBusiness ArticleBusiness { get; set; }
        public CategoryBusiness CategoryBusiness { get; set; }
        public CommentBusiness CommentBusiness { get; set; }
        protected void Page_Init(object sender, EventArgs e)
        {
            ArticleBusiness = new ArticleBusiness();
            CategoryBusiness = new CategoryBusiness();
            CommentBusiness = new CommentBusiness();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<Category> categories = CategoryBusiness.GetAll();
                CategoryRepeater.DataSource = categories;
                CategoryRepeater.DataBind();
            }
            else
            {
                SearchTextBox.Attributes["style"] = "color:black";
            }
            SearchTextBox.Attributes["onclick"] = "searchOnClick(this)";
            SearchTextBox.Attributes["onblur"] = "searchOnBlur(this)";
        }

        protected void SearchButtonClick(object sender, EventArgs e)
        {
            Response.Redirect("Search.aspx?keyword=" + SearchTextBox.Text);
        }
    }
}
